(deftemplate nori
    (slot nume)
    (slot vant)
    (slot precipitatii)
    )


(assert(nori(nume cumulus)(vant 0)(precipitatii 0)))
(assert(nori(nume nimbostratus)(vant SV->N)(precipitatii ploaie-scurta)))
(assert(nori(nume nimbostratus)(vant NE->S)(precipitatii ploaie-lunga)))
(assert(nori(nume cumulonimbus)(vant 0)(precipitatii zapada)))
(assert(nori(nume cirrostratus)(vant NE->S)(precipitatii ploaie-peste-15h->24h)))
(assert(nori(nume altostratus)(vant NE->S)(precipitatii ploaie-peste-o-zi)))


(deftemplate intrebare
				(slot stringIntrebare)
				(slot raspuns))

(assert (intrebare(stringIntrebare nil)(raspuns nil)))

(defrule vant
	?id<-(intrebare (stringIntrebare nil)(raspuns nil))
    =>
    (printout t "Bate vantul? (DA/NU): " crlf)
    (bind ?a (read))
    (assert (intrebare (stringIntrebare "Bate vantul?")(raspuns ?a)))
    (retract ?id)
    )

(defrule bateVant
	?id<-(intrebare (stringIntrebare "Bate vantul?")(raspuns DA))
    =>
    (printout t "Din ce directie bate vantul? (NE->S/SV->N): " crlf)
    (bind ?a (read))
    (assert (intrebare (stringIntrebare "Din ce directie bate vantul? (NE->S/SV->N)")(raspuns ?a)))
    (retract ?id)
    )

(defrule directieVant
	?id<-(intrebare (stringIntrebare "Din ce directie bate vantul? (NE->S/SV->N)")(raspuns NE->S))
    =>
    (printout t "Ce tip de nori sunt? (nimbostratus/cirrostratus/altostratus)" crlf)
    (bind ?a (read))
    (assert (intrebare (stringIntrebare "Ce tip de nori sunt? (nimbostratus/cirrostratus/altostratus)")(raspuns ?a)))
    (retract ?id)
    )

(defrule nimbostratus
    ?id<-(intrebare (stringIntrebare "Ce tip de nori sunt? (nimbostratus/cirrostratus/altostratus)")(raspuns nimbostratus))
    =>
    (printout t "Prognozam precipitatii sub forma de ploaie de lunga durata incepand cu urmatoarele ore" crlf)
    (retract ?id)
    )

(defrule cirrostratus
    ?id<-(intrebare (stringIntrebare "Ce tip de nori sunt? (nimbostratus/cirrostratus/altostratus)")(raspuns cirrostratus))
    =>
    (printout t "Prognozam precipitatii sub forma de ploaie incepand peste 15 - 24 de ore" crlf)
    (retract ?id)
    )

(defrule altostratus
    ?id<-(intrebare (stringIntrebare "Ce tip de nori sunt? (nimbostratus/cirrostratus/altostratus)")(raspuns altostratus))
    =>
    (printout t "Prognozam precipitatii sub forma de ploaie incepand peste 24 de ore" crlf)
    (retract ?id)
    )

(defrule nimbostratus2
	?id<-(intrebare (stringIntrebare "Din ce directie bate vantul? (NE->S/SV->N)")(raspuns SV->N))
    =>
    (printout t "Prognozam precipitatii sub forma de ploaie de scurta durata incepand cu urmatoarele ore" crlf)
    (retract ?id)
    )


(defrule faraVant
	?id<-(intrebare (stringIntrebare "Bate vantul?")(raspuns NU))
    =>
    (printout t "Ce tip de nori sunt? (cumulus/cumulonimbus)" crlf)
    (bind ?a (read))
    (assert (intrebare (stringIntrebare "Ce tip de nori sunt? (cumulus/cumulonimbus)")(raspuns ?a)))
    (retract ?id)
    )

(defrule cumulus
	?id<-(intrebare (stringIntrebare "Ce tip de nori sunt? (cumulus/cumulonimbus)")(raspuns cumulus))
    =>
    (printout t "Prognozam cer senin, dar daca incepe vant de la NE->S se pot forma nori nimbostratus care pot aduce precipitatii" crlf)
    (retract ?id)
    )

(defrule cumulonimbus
	?id<-(intrebare (stringIntrebare "Ce tip de nori sunt? (cumulus/cumulonimbus)")(raspuns cumulonimbus))
    =>
    (printout t "Prognozam precipitatii sub forma de zapada in urmatoarele ore" crlf)
    (retract ?id)
    )

(run)